package com.key.win.demo.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.key.win.base.mapper.KeyWinMapper;
import com.key.win.demo.vo.UserOrganVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface MybatiesSqlTemplateDao extends KeyWinMapper<UserOrganVo> {

    @Select("SELECT * FROM `data_log` d INNER JOIN mybaties_template m on d.fk_id = m.id ")
    public List<Map<String,Object>> getAll();

    @Select({"SELECT u.user_name ,o.`name` as organ_name FROM sys_user u INNER JOIN sys_user_organ uo on u.id = uo.user_id INNER JOIN sys_organ o on uo.organ_id = o.id ${ew.customSqlSegment}"})
    IPage<UserOrganVo> getUserOrganList(IPage<UserOrganVo> page, @Param("ew") QueryWrapper<UserOrganVo> queryWrapper);
}
